﻿

KindEditor.plugin('anchorimage', function (K) {

    var self = this,
        name = 'anchorimage';

    self.clickToolbar(name, function () {

        self.focus();

        var html = [
            '<div>',
            '<iframe id="uploadIframe" src="/Upload/UploadImgInit" style="width: 100%; height: 300px;"></iframe>',
            '</div>'
        ].join('');

        var dialog = self.createDialog({

            name: name,
            width: 450,
            title: self.lang(name),
            body: html,
            yesBtn: {
                name: self.lang('yes'),
                click: function (e) {
                   
                    //获取上传完成的资源id
                    var uploadResult = jQuery("#uploadIframe").contents().find("#img_cover").attr('src');
                    //插入内容
                    self.insertHtml('<img src="' + uploadResult + '" title="" />').hideDialog().focus();
                }
            }
        });

    });
});

